package com.h3c.gm.common

import org.springframework.util.StringUtils;

/**
 * Created by d14287 on 2017/6/26.
 */
class Response {
    Meta meta
    Object data

    Response ofSuccess(Object data) {
        this.meta = new Meta(true, "ok")
        this.data = data
        return this
    }

    Response ofFailure(String message) {
        if (StringUtils.isEmpty(message)) {
            this.meta = new Meta(false, "出现异常，请联系技术支持")
        } else {
        }
        this.meta = new Meta(false, message)
    }

    static Response instance() {
        new Response()
    }
}

class Meta {
    boolean success
    String message

    Meta(boolean success, String message) {
        this.success = success
        this.message = message
    }
}
